#import "file_config_game.h"

/*object config
*/
UICenterRect g_CfgGameElementArea;
UICenterRect g_CfgGameScrrenArea[20];
CGPoint g_CfgGameBowBase;
UICenterRect g_CfgGameArrowValidArea;
float g_CfgGameArrowLevelUpHoldTime;
float g_CfgGameArrowCoolDownTime;
CGSize g_CfgGameParabolaTouch;
UICenterRect g_CfgGameLinearTouch;

CGPoint g_CfgGameItem1HolderPosition;
CGPoint g_CfgGameItem2HolderPosition;

CGPoint g_CfgGameBridgePosition;
CGSize g_CfgGameBridgeSize;
CGPoint g_CfgGameBridgeArcLeft;
CGPoint g_CfgGameBridgeArcRight;
CGPoint g_CfgGameBridgeArcTop;
char g_CfgGameImageBridgePath[STRING_BUF_SIZE];
char g_CfgGameImageBridgeRedPath[STRING_BUF_SIZE];
char g_CfgGameImageBridgeCloudPath[STRING_BUF_SIZE];
char g_CfgGameImageBridgeBoyPath[STRING_BUF_SIZE];
char g_CfgGameImageBridgeGirdPath[STRING_BUF_SIZE];
UIAnimationObject g_CfgGameAniBridgeCover;

CGPoint g_CfgGameTimeBarPosition;

/*menu config
*/
UIImageObject g_CfgGameMenuBackgroundWin;
UIImageObject g_CfgGameMenuBackgroundLose;

UIImageObject g_CfgGameMenuImagePause;
CGPoint g_CfgGameMenuTitlePosition;

char g_CfgGameMenuStarOn[STRING_BUF_SIZE];
char g_CfgGameMenuStarOff[STRING_BUF_SIZE];

CGPoint g_CfgGameMenuStarHeartPosition;
CGPoint g_CfgGameMenuStarEnemyPosition;
CGPoint g_CfgGameMenuStarSpecialPosition;
CGPoint g_CfgGameMenuTextHeartPosition;
CGPoint g_CfgGameMenuTextEnemyPosition;
CGPoint g_CfgGameMenuTextSpecialPosition;

UIMenuItemImageObject g_CfgGameMenuItemResume;
UIMenuItemImageObject g_CfgGameMenuItemRestart;
UIMenuItemImageObject g_CfgGameMenuItemQuit;
UIMenuItemImageObject g_CfgGameMenuItemRetry;
UIMenuItemImageObject g_CfgGameMenuItemNext;
UIMenuItemImageObject g_CfgGameMenuItemBackMenu;

/*background config
*/
char g_CfgGameBg0ImagePath[STRING_BUF_SIZE];

ccColor3B g_CfgGameBg1BackColor;
char g_CfgGameBg1ImageStar1Path[STRING_BUF_SIZE];
char g_CfgGameBg1ImageStar2Path[STRING_BUF_SIZE];
char g_CfgGameBg1ImageMoonPath[STRING_BUF_SIZE];
char g_CfgGameBg1ImageCloud[STRING_BUF_SIZE];
char g_CfgGameBg1ImageCastle[STRING_BUF_SIZE];
int g_CfgGameBg1StarStartY;
int g_CfgGameBg1StarEndY;
int g_CfgGameBg1MoonStartY;
int g_CfgGameBg1MoonEndY;
int g_CfgGameBg1CloudStartY;
int g_CfgGameBg1CloudEndY;
int g_CfgGameBg1CastleStartY;
int g_CfgGameBg1CastleEndY;

ccColor3B g_CfgGameBg2BackColor;
char g_CfgGameBg2ImageCloudPath[STRING_BUF_SIZE];
char g_CfgGameBg2ImageHillPath[STRING_BUF_SIZE];
int g_CfgGameBg2CloudStartY;
int g_CfgGameBg2CloudEndY;
int g_CfgGameBg2HillStartY;
int g_CfgGameBg2HillEndY;

char g_CfgGameBg3ImageBackPath[STRING_BUF_SIZE];
char g_CfgGameBg3ImageUpLeftPath[STRING_BUF_SIZE];
char g_CfgGameBg3ImageUpRightPath[STRING_BUF_SIZE];
char g_CfgGameBg3ImageDonwPath[STRING_BUF_SIZE];
char g_CfgGameBg3ImageMiddlePath[STRING_BUF_SIZE];
char g_CfgGameBg3ImageMiddleEffectPath[STRING_BUF_SIZE];
CGPoint g_CfgGameBg3UpLeftStartPosition;
CGPoint g_CfgGameBg3UpLeftEndPosition;
CGPoint g_CfgGameBg3UpRightStartPosition;
CGPoint g_CfgGameBg3UpRightEndPosition;
CGPoint g_CfgGameBg3DownStartPosition;
CGPoint g_CfgGameBg3DownEndPosition;
CGPoint g_CfgGameBg3MiddleStartPosition;
CGPoint g_CfgGameBg3MiddleEndPositio;
CGPoint g_CfgGameBg3MiddleEffectStartPosition;
CGPoint g_CfgGameBg3MiddleEffectEndPosition;

/*resource config table
*/
SBaseDataBow g_CfgGameBowDataTable[BOW_TYPE_COUNT];
SBaseDataArrow g_CfgGameArrowDataTable[ARROW_TYPE_COUNT];
SBaseDataEnemy g_CfgGameEnemyDataTable[ENEMY_TYPE_COUNT];
SBaseDataBoss1 g_CfgGameBoss1Data;
SBaseDataBoss2 g_CfgGameBoss2Data;
SBaseDataBoss3 g_CfgGameBoss3Data;
SBaseDataBomb g_CfgGameBombDataTable[BOMB_TYPE_COUNT];
SBaseDataSwirl g_CfgGameSwirlDataTable[SWIRL_TYPE_COUNT];
SBaseDataHeart g_CfgGameHeartData;

void CfgGameSetScreenArea(void);
void CfgGameLoadBaseFile(FILE *File);
void CfgGameLoadBackgroundFile(FILE *File);
void CfgGameLoadTableBow(FILE *File);
void CfgGameLoadTableArrow(FILE *File);
void CfgGameLoadTableEnemy(FILE *File);
void CfgGameLoadTableBomb(FILE *File);
void CfgGameLoadTableHeart(FILE *File);

void CfgGameLoadConfigFile(void)
{
	char _Buffer[STRING_BUF_SIZE];
	FILE *_File;

	memset(_Buffer, 0, sizeof _Buffer);
	[[CCFileUtils fullPathFromRelativePath:@"file_config_game.xml"] getCString:_Buffer maxLength:sizeof _Buffer encoding:NSASCIIStringEncoding];
	_File = fopen(_Buffer, "r");
	NULL != _File ? CfgGameLoadBaseFile(_File) : exit(0);
	fclose(_File);
	memset(_Buffer, 0, sizeof _Buffer);
	[[CCFileUtils fullPathFromRelativePath:@"file_game_background.xml"] getCString:_Buffer maxLength:sizeof _Buffer encoding:NSASCIIStringEncoding];
	_File = fopen(_Buffer, "r");
	NULL != _File ? CfgGameLoadBackgroundFile(_File) : exit(0);
	fclose(_File);
	memset(_Buffer, 0, sizeof _Buffer);
	[[CCFileUtils fullPathFromRelativePath:@"file_table_bow.xml"] getCString:_Buffer maxLength:sizeof _Buffer encoding:NSASCIIStringEncoding];
	_File = fopen(_Buffer, "r");
	NULL != _File ? CfgGameLoadTableBow(_File) : exit(0);
	fclose(_File);
	memset(_Buffer, 0, sizeof _Buffer);
	[[CCFileUtils fullPathFromRelativePath:@"file_table_arrow.xml"] getCString:_Buffer maxLength:sizeof _Buffer encoding:NSASCIIStringEncoding];
	_File = fopen(_Buffer, "r");
	NULL != _File ? CfgGameLoadTableArrow(_File) : exit(0);
	fclose(_File);
	memset(_Buffer, 0, sizeof _Buffer);
	[[CCFileUtils fullPathFromRelativePath:@"file_table_enemy.xml"] getCString:_Buffer maxLength:sizeof _Buffer encoding:NSASCIIStringEncoding];
	_File = fopen(_Buffer, "r");
	NULL != _File ? CfgGameLoadTableEnemy(_File) : exit(0);
	fclose(_File);
	memset(_Buffer, 0, sizeof _Buffer);
	[[CCFileUtils fullPathFromRelativePath:@"file_table_bomb.xml"] getCString:_Buffer maxLength:sizeof _Buffer encoding:NSASCIIStringEncoding];
	_File = fopen(_Buffer, "r");
	NULL != _File ? CfgGameLoadTableBomb(_File) : exit(0);
	fclose(_File);
	memset(_Buffer, 0, sizeof _Buffer);
	[[CCFileUtils fullPathFromRelativePath:@"file_table_heart.xml"] getCString:_Buffer maxLength:sizeof _Buffer encoding:NSASCIIStringEncoding];
	_File = fopen(_Buffer, "r");
	NULL != _File ? CfgGameLoadTableHeart(_File) : exit(0);
	fclose(_File);
}

CGPoint CfgGameGetPointCGPoint(int AreaIndex)
{
	return ptConvertb2Vec2ToCGPoint(CfgGameGetPointb2Vec2(AreaIndex));
}

b2Vec2 CfgGameGetPointb2Vec2(int AreaIndex)
{
	float _x, _y;
	float _RandomX, _RandomY;

	_x = g_CfgGameScrrenArea[AreaIndex].center.x - g_CfgGameScrrenArea[AreaIndex].size.width / 2;
	_y = g_CfgGameScrrenArea[AreaIndex].center.y - g_CfgGameScrrenArea[AreaIndex].size.height / 2;
	_RandomX = (int)rand() % (int)g_CfgGameScrrenArea[AreaIndex].size.width;
	_RandomY = (int)rand() % (int)g_CfgGameScrrenArea[AreaIndex].size.height;
	return b2Vec2(_x + _RandomX, _y + _RandomY);
}

int CfgGameGetAreaIndex(CGPoint Position)
{
	int _Ret;
	float _Distance;

	_Ret = 0;
	_Distance = ptPointDistance_CGPoint(Position, g_CfgGameScrrenArea[0].center);
	for (int i = 1; i < 9; ++i)
	{
		if (_Distance > ptPointDistance_CGPoint(Position, g_CfgGameScrrenArea[i].center))
		{
			_Distance = ptPointDistance_CGPoint(Position, g_CfgGameScrrenArea[i].center);
			_Ret = i;
		}
	}
	return _Ret;
}

void CfgGameSetScreenArea(void)
{
	int i, j, _Index;
	float _x, _y;
	CGSize _Size;

	memset(g_CfgGameScrrenArea, 0, sizeof g_CfgGameScrrenArea);

	/*0-8
	*/
	_Size.width = g_CfgGameElementArea.size.width / 3.0f;
	_Size.height = g_CfgGameElementArea.size.height / 3.0f;
	_Index = 0;
	_y = g_CfgGameElementArea.center.y - g_CfgGameElementArea.size.height / 3.0f;
	for (i = 0; i < 3; i++)
	{
		_x = _Size.width / 2;
		for (j = 0; j < 3; j++)
		{
			g_CfgGameScrrenArea[_Index].center = ccp(_x, _y);
			g_CfgGameScrrenArea[_Index].size = _Size;
			_Index++;
			_x += _Size.width;
		}
		_y += _Size.height;
	}

	/*9
	11
	*/
	_Size = CGSizeMake(OFF_SCRREN_AREA_W, g_CfgGameScrrenArea[0].size.height);
	_x = 0 - SPLITE_SIZE - _Size.width / 2.0f;
	_y = g_CfgGameScrrenArea[0].center.y;
	for (i = 0; i < 3; i++)
	{
		g_CfgGameScrrenArea[_Index].center = ccp(_x, _y);
		g_CfgGameScrrenArea[_Index].size = _Size;
		_Index++;
		_y += _Size.height;
	}

	/*12
	*/
	_Size = CGSizeMake(OFF_SCRREN_AREA_W, OFF_SCRREN_AREA_H);
	_x = g_CfgGameScrrenArea[9].center.x;
	_y = g_CfgGameScrrenArea[11].center.y + g_CfgGameScrrenArea[11].size.height / 2 + SPLITE_SIZE + OFF_SCRREN_AREA_H / 2;
	g_CfgGameScrrenArea[_Index].center = ccp(_x, _y);
	g_CfgGameScrrenArea[_Index].size = _Size;
	_Index++;

	/*13-15
	*/
	_Size = CGSizeMake(g_CfgGameScrrenArea[0].size.width, OFF_SCRREN_AREA_H);
	_x = g_CfgGameScrrenArea[0].center.x;
	_y = g_CfgGameScrrenArea[12].center.y;
	for (i = 0; i < 3; i++)
	{
		g_CfgGameScrrenArea[_Index].center = ccp(_x, _y);
		g_CfgGameScrrenArea[_Index].size = _Size;
		_Index++;
		_x += _Size.width;
	}

	/*16
	*/
	_Size = g_CfgGameScrrenArea[12].size;
	_x = g_CfgGameScrrenArea[15].center.x + g_CfgGameScrrenArea[15].size.width / 2 + SPLITE_SIZE + _Size.width / 2;
	_y = g_CfgGameScrrenArea[15].center.y;
	g_CfgGameScrrenArea[_Index].center = ccp(_x, _y);
	g_CfgGameScrrenArea[_Index].size = _Size;
	_Index++;

	/*17-19
	*/
	_Size = g_CfgGameScrrenArea[11].size;
	_x = g_CfgGameScrrenArea[16].center.x;
	_y = g_CfgGameScrrenArea[8].center.y;
	for (i = 0; i < 3; i++)
	{
		g_CfgGameScrrenArea[_Index].center = ccp(_x, _y);
		g_CfgGameScrrenArea[_Index].size = _Size;
		_Index++;
		_y -= _Size.height;
	}
}

void CfgGameLoadBaseFile(FILE *File)
{
	mxml_node_t *_NodeXml, *_NodeBouy;

	_NodeXml = mxmlLoadFile(NULL, File, MXML_TEXT_CALLBACK);
	_NodeBouy = mxmlGetFirstChild(_NodeXml);
	for (; NULL != _NodeBouy; _NodeBouy = mxmlWalkNext(_NodeBouy, _NodeXml, MXML_NO_DESCEND))
	{
		/*element area
		*/
		if (tmxmlIsElement(_NodeBouy, "center_rect_element_area"))
		{
			uiLoadCenterRectFromXML(_NodeBouy, &g_CfgGameElementArea);
			CfgGameSetScreenArea();
		}
		/*bow & arrow
		*/
		else if (tmxmlIsElement(_NodeBouy, "point_bow_base"))
		{
			uiLoadPointFromXML(_NodeBouy, &g_CfgGameBowBase);
		}
		else if (tmxmlIsElement(_NodeBouy, "center_rect_arrow_valid_area"))
		{
			uiLoadCenterRectFromXML(_NodeBouy, &g_CfgGameArrowValidArea);
		}
		else if (tmxmlIsElement(_NodeBouy, "size_arrow_parabola_touch"))
		{
			uiLoadSizeFromXML(_NodeBouy, &g_CfgGameParabolaTouch);
		}
		else if (tmxmlIsElement(_NodeBouy, "center_rect_arrow_linear_touch"))
		{
			uiLoadCenterRectFromXML(_NodeBouy, &g_CfgGameLinearTouch);
		}
		/*item
		*/
		else if (tmxmlIsElement(_NodeBouy, "item_holder_1_position"))
		{
			uiLoadPointFromXML(_NodeBouy, &g_CfgGameItem1HolderPosition);
		}
		else if (tmxmlIsElement(_NodeBouy, "item_holder_2_position"))
		{
			uiLoadPointFromXML(_NodeBouy, &g_CfgGameItem2HolderPosition);
		}
		/*bridge
		*/
		else if (tmxmlIsElement(_NodeBouy, "point_bridge"))
		{
			uiLoadPointFromXML(_NodeBouy, &g_CfgGameBridgePosition);
		}
		else if (tmxmlIsElement(_NodeBouy, "size_bridge"))
		{
			uiLoadSizeFromXML(_NodeBouy, &g_CfgGameBridgeSize);
		}
		else if (tmxmlIsElement(_NodeBouy, "point_bridge_arc_left"))
		{
			uiLoadPointFromXML(_NodeBouy, &g_CfgGameBridgeArcLeft);
		}
		else if (tmxmlIsElement(_NodeBouy, "point_bridge_arc_right"))
		{
			uiLoadPointFromXML(_NodeBouy, &g_CfgGameBridgeArcRight);
		}
		else if (tmxmlIsElement(_NodeBouy, "point_bridge_arc_top"))
		{
			uiLoadPointFromXML(_NodeBouy, &g_CfgGameBridgeArcTop);
		}
		else if (tmxmlIsElement(_NodeBouy, "image_bridge_path"))
		{
			tmxmlElementReadChildText(_NodeBouy, g_CfgGameImageBridgePath);
		}
		else if (tmxmlIsElement(_NodeBouy, "image_bridge_red_path"))
		{
			tmxmlElementReadChildText(_NodeBouy, g_CfgGameImageBridgeRedPath);
		}
		else if (tmxmlIsElement(_NodeBouy, "image_bridge_cloud_path"))
		{
			tmxmlElementReadChildText(_NodeBouy, g_CfgGameImageBridgeCloudPath);
		}
		else if (tmxmlIsElement(_NodeBouy, "image_bridge_boy_path"))
		{
			tmxmlElementReadChildText(_NodeBouy, g_CfgGameImageBridgeBoyPath);
		}
		else if (tmxmlIsElement(_NodeBouy, "image_bridge_girl_path"))
		{
			tmxmlElementReadChildText(_NodeBouy, g_CfgGameImageBridgeGirdPath);
		}
		else if (tmxmlIsElement(_NodeBouy, "ani_bridge_cover"))
		{
			uiLoadAnimationObjectFromXML(_NodeBouy, &g_CfgGameAniBridgeCover);
		}
		/*time bar
		*/
		else if (tmxmlIsElement(_NodeBouy, "point_time_bar"))
		{
			uiLoadPointFromXML(_NodeBouy, &g_CfgGameTimeBarPosition);
		}
		/*menu
		*/
		else if (tmxmlIsElement(_NodeBouy, "image_menu_background_win"))
		{
			uiLoadImageObjectFromXML(_NodeBouy, &g_CfgGameMenuBackgroundWin);
		}
		else if (tmxmlIsElement(_NodeBouy, "image_menu_background_lose"))
		{
			uiLoadImageObjectFromXML(_NodeBouy, &g_CfgGameMenuBackgroundLose);
		}
		else if (tmxmlIsElement(_NodeBouy, "image_menu_pause"))
		{
			uiLoadImageObjectFromXML(_NodeBouy, &g_CfgGameMenuImagePause);
		}
		else if (tmxmlIsElement(_NodeBouy, "point_menu_title_position"))
		{
			uiLoadPointFromXML(_NodeBouy, &g_CfgGameMenuTitlePosition);
		}
		else if (tmxmlIsElement(_NodeBouy, "image_menu_star_on_path"))
		{
			tmxmlElementReadChildText(_NodeBouy, g_CfgGameMenuStarOn);
		}
		else if (tmxmlIsElement(_NodeBouy, "image_menu_star_off_path"))
		{
			tmxmlElementReadChildText(_NodeBouy, g_CfgGameMenuStarOff);
		}
		else if (tmxmlIsElement(_NodeBouy, "point_menu_star_heart_position"))
		{
			uiLoadPointFromXML(_NodeBouy, &g_CfgGameMenuStarHeartPosition);
		}
		else if (tmxmlIsElement(_NodeBouy, "point_menu_star_enemy_position"))
		{
			uiLoadPointFromXML(_NodeBouy, &g_CfgGameMenuStarEnemyPosition);
		}
		else if (tmxmlIsElement(_NodeBouy, "point_menu_star_special_position"))
		{
			uiLoadPointFromXML(_NodeBouy, &g_CfgGameMenuStarSpecialPosition);
		}
		else if (tmxmlIsElement(_NodeBouy, "point_menu_text_heart_position"))
		{
			uiLoadPointFromXML(_NodeBouy, &g_CfgGameMenuTextHeartPosition);
		}
		else if (tmxmlIsElement(_NodeBouy, "point_menu_text_enemy_position"))
		{
			uiLoadPointFromXML(_NodeBouy, &g_CfgGameMenuTextEnemyPosition);
		}
		else if (tmxmlIsElement(_NodeBouy, "point_menu_text_special_position"))
		{
			uiLoadPointFromXML(_NodeBouy, &g_CfgGameMenuTextSpecialPosition);
		}
		else if (tmxmlIsElement(_NodeBouy, "item_menu_resume"))
		{
			uiLoadMenuItemImageObjectFromXML(_NodeBouy, &g_CfgGameMenuItemResume);
		}
		else if (tmxmlIsElement(_NodeBouy, "item_menu_restart"))
		{
			uiLoadMenuItemImageObjectFromXML(_NodeBouy, &g_CfgGameMenuItemRestart);
		}
		else if (tmxmlIsElement(_NodeBouy, "item_menu_quit"))
		{
			uiLoadMenuItemImageObjectFromXML(_NodeBouy, &g_CfgGameMenuItemQuit);
		}
		else if (tmxmlIsElement(_NodeBouy, "item_menu_retry"))
		{
			uiLoadMenuItemImageObjectFromXML(_NodeBouy, &g_CfgGameMenuItemRetry);
		}
		else if (tmxmlIsElement(_NodeBouy, "item_menu_next"))
		{
			uiLoadMenuItemImageObjectFromXML(_NodeBouy, &g_CfgGameMenuItemNext);
		}
		else if (tmxmlIsElement(_NodeBouy, "item_menu_back_menu"))
		{
			uiLoadMenuItemImageObjectFromXML(_NodeBouy, &g_CfgGameMenuItemBackMenu);
		}
	}

	mxmlDelete(_NodeXml);
}

void CfgGameLoadBackgroundFile(FILE *File)
{
	mxml_node_t *_NodeXml, *_NodeBouy, *_NodeSubBouy;

	_NodeXml = mxmlLoadFile(NULL, File, MXML_TEXT_CALLBACK);
	_NodeBouy = mxmlGetFirstChild(_NodeXml);
	for (; NULL != _NodeBouy; _NodeBouy = mxmlWalkNext(_NodeBouy, _NodeXml, MXML_NO_DESCEND))
	{
		/*bg 0
		*/
		if (tmxmlIsElement(_NodeBouy, "game_background_0"))
		{
			_NodeSubBouy = mxmlGetFirstChild(_NodeBouy);
			for (; NULL != _NodeSubBouy; _NodeSubBouy = mxmlWalkNext(_NodeSubBouy, _NodeBouy, MXML_NO_DESCEND))
			{
				if (tmxmlIsElement(_NodeSubBouy, "image_path"))
				{
					tmxmlElementReadChildText(_NodeSubBouy, g_CfgGameBg0ImagePath);
				}
			}
		}
		/*bg 1
		*/
		else if (tmxmlIsElement(_NodeBouy, "game_background_1"))
		{
			_NodeSubBouy = mxmlGetFirstChild(_NodeBouy);
			for (; NULL != _NodeSubBouy; _NodeSubBouy = mxmlWalkNext(_NodeSubBouy, _NodeBouy, MXML_NO_DESCEND))
			{
				if (tmxmlIsElement(_NodeSubBouy, "back_color"))
				{
					uiLoadColorFromXML(_NodeSubBouy, &g_CfgGameBg1BackColor);
				}
				else if (tmxmlIsElement(_NodeSubBouy, "image_star_1"))
				{
					tmxmlElementReadChildText(_NodeSubBouy, g_CfgGameBg1ImageStar1Path);
				}
				else if (tmxmlIsElement(_NodeSubBouy, "image_star_2"))
				{
					tmxmlElementReadChildText(_NodeSubBouy, g_CfgGameBg1ImageStar2Path);
				}
				else if (tmxmlIsElement(_NodeSubBouy, "image_moon"))
				{
					tmxmlElementReadChildText(_NodeSubBouy, g_CfgGameBg1ImageMoonPath);
				}
				else if (tmxmlIsElement(_NodeSubBouy, "image_cloud"))
				{
					tmxmlElementReadChildText(_NodeSubBouy, g_CfgGameBg1ImageCloud);
				}
				else if (tmxmlIsElement(_NodeSubBouy, "image_castle"))
				{
					tmxmlElementReadChildText(_NodeSubBouy, g_CfgGameBg1ImageCastle);
				}
				else if (tmxmlIsElement(_NodeSubBouy, "star_start_y"))
				{
					g_CfgGameBg1StarStartY = tmxmlElementReadChildInt(_NodeSubBouy);
				}
				else if (tmxmlIsElement(_NodeSubBouy, "star_end_y"))
				{
					g_CfgGameBg1StarEndY = tmxmlElementReadChildInt(_NodeSubBouy);
				}
				else if (tmxmlIsElement(_NodeSubBouy, "moon_start_y"))
				{
					g_CfgGameBg1MoonStartY = tmxmlElementReadChildInt(_NodeSubBouy);
				}
				else if (tmxmlIsElement(_NodeSubBouy, "moon_end_y"))
				{
					g_CfgGameBg1MoonEndY = tmxmlElementReadChildInt(_NodeSubBouy);
				}
				else if (tmxmlIsElement(_NodeSubBouy, "cloud_start_y"))
				{
					g_CfgGameBg1CloudStartY = tmxmlElementReadChildInt(_NodeSubBouy);
				}
				else if (tmxmlIsElement(_NodeSubBouy, "cloud_end_y"))
				{
					g_CfgGameBg1CloudEndY = tmxmlElementReadChildInt(_NodeSubBouy);
				}
				else if (tmxmlIsElement(_NodeSubBouy, "castle_start_y"))
				{
					g_CfgGameBg1CastleStartY = tmxmlElementReadChildInt(_NodeSubBouy);
				}
				else if (tmxmlIsElement(_NodeSubBouy, "castle_end_y"))
				{
					g_CfgGameBg1CastleEndY = tmxmlElementReadChildInt(_NodeSubBouy);
				}
			}
		}
		/*bg 2
		*/
		else if (tmxmlIsElement(_NodeBouy, "game_background_2"))
		{
			_NodeSubBouy = mxmlGetFirstChild(_NodeBouy);
			for (; NULL != _NodeSubBouy; _NodeSubBouy = mxmlWalkNext(_NodeSubBouy, _NodeBouy, MXML_NO_DESCEND))
			{
				if (tmxmlIsElement(_NodeSubBouy, "back_color"))
				{
					uiLoadColorFromXML(_NodeSubBouy, &g_CfgGameBg2BackColor);
				}
				else if (tmxmlIsElement(_NodeSubBouy, "image_cloud"))
				{
					tmxmlElementReadChildText(_NodeSubBouy, g_CfgGameBg2ImageCloudPath);
				}
				else if (tmxmlIsElement(_NodeSubBouy, "image_hill"))
				{
					tmxmlElementReadChildText(_NodeSubBouy, g_CfgGameBg2ImageHillPath);
				}
				else if (tmxmlIsElement(_NodeSubBouy, "cloud_start_y"))
				{
					g_CfgGameBg2CloudStartY = tmxmlElementReadChildInt(_NodeSubBouy);
				}
				else if (tmxmlIsElement(_NodeSubBouy, "cloud_end_y"))
				{
					g_CfgGameBg2CloudEndY = tmxmlElementReadChildInt(_NodeSubBouy);
				}
				else if (tmxmlIsElement(_NodeSubBouy, "hill_start_y"))
				{
					g_CfgGameBg2HillStartY = tmxmlElementReadChildInt(_NodeSubBouy);
				}
				else if (tmxmlIsElement(_NodeSubBouy, "hill_end_y"))
				{
					g_CfgGameBg2HillEndY = tmxmlElementReadChildInt(_NodeSubBouy);
				}
			}
		}
		/*bg 3
		*/
		else if (tmxmlIsElement(_NodeBouy, "game_background_3"))
		{
			_NodeSubBouy = mxmlGetFirstChild(_NodeBouy);
			for (; NULL != _NodeSubBouy; _NodeSubBouy = mxmlWalkNext(_NodeSubBouy, _NodeBouy, MXML_NO_DESCEND))
			{
				if (tmxmlIsElement(_NodeSubBouy, "image_back"))
				{
					tmxmlElementReadChildText(_NodeSubBouy, g_CfgGameBg3ImageBackPath);
				}
				else if (tmxmlIsElement(_NodeSubBouy, "image_up_left"))
				{
					tmxmlElementReadChildText(_NodeSubBouy, g_CfgGameBg3ImageUpLeftPath);
				}
				else if (tmxmlIsElement(_NodeSubBouy, "image_up_right"))
				{
					tmxmlElementReadChildText(_NodeSubBouy, g_CfgGameBg3ImageUpRightPath);
				}
				else if (tmxmlIsElement(_NodeSubBouy, "image_down"))
				{
					tmxmlElementReadChildText(_NodeSubBouy, g_CfgGameBg3ImageDonwPath);
				}
				else if (tmxmlIsElement(_NodeSubBouy, "image_middle"))
				{
					tmxmlElementReadChildText(_NodeSubBouy, g_CfgGameBg3ImageMiddlePath);
				}
				else if (tmxmlIsElement(_NodeSubBouy, "image_middle_effect"))
				{
					tmxmlElementReadChildText(_NodeSubBouy, g_CfgGameBg3ImageMiddleEffectPath);
				}
				else if (tmxmlIsElement(_NodeSubBouy, "up_left_start_position"))
				{
					uiLoadPointFromXML(_NodeSubBouy, &g_CfgGameBg3UpLeftStartPosition);
				}
				else if (tmxmlIsElement(_NodeSubBouy, "up_left_end_position"))
				{
					uiLoadPointFromXML(_NodeSubBouy, &g_CfgGameBg3UpLeftEndPosition);
				}
				else if (tmxmlIsElement(_NodeSubBouy, "up_right_start_position"))
				{
					uiLoadPointFromXML(_NodeSubBouy, &g_CfgGameBg3UpRightStartPosition);
				}
				else if (tmxmlIsElement(_NodeSubBouy, "up_right_end_position"))
				{
					uiLoadPointFromXML(_NodeSubBouy, &g_CfgGameBg3UpRightEndPosition);
				}
				else if (tmxmlIsElement(_NodeSubBouy, "down_start_position"))
				{
					uiLoadPointFromXML(_NodeSubBouy, &g_CfgGameBg3DownStartPosition);
				}
				else if (tmxmlIsElement(_NodeSubBouy, "down_end_position"))
				{
					uiLoadPointFromXML(_NodeSubBouy, &g_CfgGameBg3DownEndPosition);
				}
				else if (tmxmlIsElement(_NodeSubBouy, "middle_start_position"))
				{
					uiLoadPointFromXML(_NodeSubBouy, &g_CfgGameBg3MiddleStartPosition);
				}
				else if (tmxmlIsElement(_NodeSubBouy, "middle_end_position"))
				{
					uiLoadPointFromXML(_NodeSubBouy, &g_CfgGameBg3MiddleEndPositio);
				}
				else if (tmxmlIsElement(_NodeSubBouy, "middle_effect_start_position"))
				{
					uiLoadPointFromXML(_NodeSubBouy, &g_CfgGameBg3MiddleEffectStartPosition);
				}
				else if (tmxmlIsElement(_NodeSubBouy, "middle_effect_end_position"))
				{
					uiLoadPointFromXML(_NodeSubBouy, &g_CfgGameBg3MiddleEffectEndPosition);
				}
			}
		}
	}
}

void CfgGameLoadTableBow(FILE *File)
{
	mxml_node_t *_NodeXml, *_NodeBouy, *_NodeBowBouy;
	int _Index;

	_Index = 0;
	_NodeXml = mxmlLoadFile(NULL, File, MXML_TEXT_CALLBACK);
	_NodeBouy = mxmlGetFirstChild(_NodeXml);
	for (; NULL != _NodeBouy; _NodeBouy = mxmlWalkNext(_NodeBouy, _NodeXml, MXML_NO_DESCEND))
	{
		if (tmxmlIsElement(_NodeBouy, "bow"))
		{
			_NodeBowBouy = mxmlGetFirstChild(_NodeBouy);
			for (; NULL != _NodeBowBouy; _NodeBowBouy = mxmlWalkNext(_NodeBowBouy, _NodeBouy, MXML_NO_DESCEND))
			{
				if (tmxmlIsElement(_NodeBowBouy, "type"))
				{
					_Index = tmxmlElementReadChildInt(_NodeBowBouy);
				}
				else if (tmxmlIsElement(_NodeBowBouy, "anchor_point_to_bottom"))
				{
					g_CfgGameBowDataTable[_Index].anchor_point_to_bottom = tmxmlElementReadChildInt(_NodeBowBouy);
				}
				else if (tmxmlIsElement(_NodeBowBouy, "point_left"))
				{
					uiLoadPointFromXML(_NodeBowBouy, &g_CfgGameBowDataTable[_Index].left_point);
				}
				else if (tmxmlIsElement(_NodeBowBouy, "point_right"))
				{
					uiLoadPointFromXML(_NodeBowBouy, &g_CfgGameBowDataTable[_Index].right_point);
				}
				else if (tmxmlIsElement(_NodeBowBouy, "arrow_type"))
				{
					g_CfgGameBowDataTable[_Index].arrow_type = tmxmlElementReadChildInt(_NodeBowBouy);
				}
				else if (tmxmlIsElement(_NodeBowBouy, "image_path"))
				{
					tmxmlElementReadChildText(_NodeBowBouy, g_CfgGameBowDataTable[_Index].image_path);
				}
				else if (tmxmlIsElement(_NodeBowBouy, "image_size"))
				{
					uiLoadSizeFromXML(_NodeBowBouy, &g_CfgGameBowDataTable[_Index].image_size);
				}
				else if (tmxmlIsElement(_NodeBowBouy, "ani_normal"))
				{
					uiLoadAnimationObjectFromXML(_NodeBowBouy, &g_CfgGameBowDataTable[_Index].ani_normal);
				}
				else if (tmxmlIsElement(_NodeBowBouy, "ani_release"))
				{
					uiLoadAnimationObjectFromXML(_NodeBowBouy, &g_CfgGameBowDataTable[_Index].ani_release);
				}
			}
		}
	}
	mxmlDelete(_NodeXml);
}

void CfgGameLoadTableArrow(FILE *File)
{
	mxml_node_t *_NodeXml, *_NodeBouy, *_NodeArrowBouy;
	int _Index;

	_NodeXml = mxmlLoadFile(NULL, File, MXML_TEXT_CALLBACK);
	_NodeBouy = mxmlGetFirstChild(_NodeXml);
	for (; NULL != _NodeBouy; _NodeBouy = mxmlWalkNext(_NodeBouy, _NodeXml, MXML_NO_DESCEND))
	{
		if (tmxmlIsElement(_NodeBouy, "arrow"))
		{
			_NodeArrowBouy = mxmlGetFirstChild(_NodeBouy);
			for (; NULL != _NodeArrowBouy; _NodeArrowBouy = mxmlWalkNext(_NodeArrowBouy, _NodeBouy, MXML_NO_DESCEND))
			{
				if (tmxmlIsElement(_NodeArrowBouy, "type"))
				{
					_Index = tmxmlElementReadChildInt(_NodeArrowBouy);
				}
				else if (tmxmlIsElement(_NodeArrowBouy, "level_max"))
				{
					g_CfgGameArrowDataTable[_Index].level_max = tmxmlElementReadChildInt(_NodeArrowBouy);
				}
				else if (tmxmlIsElement(_NodeArrowBouy, "level_up_hold_time"))
				{
					tmxmlReadFloatTable(_NodeArrowBouy, &g_CfgGameArrowDataTable[_Index].level_up_hold_time_table, "data");
				}
				else if (tmxmlIsElement(_NodeArrowBouy, "attack_point"))
				{
					tmxmlReadIntTable(_NodeArrowBouy, &g_CfgGameArrowDataTable[_Index].attack_point_table, "data");
				}
				else if (tmxmlIsElement(_NodeArrowBouy, "perforation"))
				{
					tmxmlReadIntTable(_NodeArrowBouy, &g_CfgGameArrowDataTable[_Index].perforation_table, "data");
				}
				else if (tmxmlIsElement(_NodeArrowBouy, "cool_down_time"))
				{
					g_CfgGameArrowDataTable[_Index].cool_down_time = tmxmlElementReadChildFloat(_NodeArrowBouy);
				}
				else if (tmxmlIsElement(_NodeArrowBouy, "collision"))
				{
					tmxmlReadCGPointTable(_NodeArrowBouy, &g_CfgGameArrowDataTable[_Index].box2d_collision_point_table);
				}
				else if (tmxmlIsElement(_NodeArrowBouy, "max_drag_distance"))
				{
					g_CfgGameArrowDataTable[_Index].max_drag_distance = tmxmlElementReadChildInt(_NodeArrowBouy);
				}
				else if (tmxmlIsElement(_NodeArrowBouy, "image_path"))
				{
					tmxmlReadStringTable(_NodeArrowBouy, &g_CfgGameArrowDataTable[_Index].image_path_table, "path");
				}
				else if (tmxmlIsElement(_NodeArrowBouy, "image_size"))
				{
					uiLoadSizeFromXML(_NodeArrowBouy, &g_CfgGameArrowDataTable[_Index].image_size);
				}
				else if (tmxmlIsElement(_NodeArrowBouy, "particle_path"))
				{
					tmxmlElementReadChildText(_NodeArrowBouy, g_CfgGameArrowDataTable[_Index].particle_path);
				}
				else if (tmxmlIsElement(_NodeArrowBouy, "ani_normal"))
				{
					uiLoadAnimationObjectFromXML(_NodeArrowBouy, &g_CfgGameArrowDataTable[_Index].ani_normal);
				}
				else if (tmxmlIsElement(_NodeArrowBouy, "ani_invalid"))
				{
					uiLoadAnimationObjectFromXML(_NodeArrowBouy, &g_CfgGameArrowDataTable[_Index].ani_invalid);
				}
				else if (tmxmlIsElement(_NodeArrowBouy, "ani_explode"))
				{
					uiLoadAnimationObjectFromXML(_NodeArrowBouy, &g_CfgGameArrowDataTable[_Index].ani_explode);
				}
			}
		}
	}
	mxmlDelete(_NodeXml);
}

void CfgGameLoadTableEnemy(FILE *File)
{
	mxml_node_t *_NodeXml, *_NodeBouy, *_NodeEnemyBouy, *_NodeBoss1Bouy, *_NodeBoss2Bouy, *_NodeBoss3Bouy;
	int _Index;

	_NodeXml = mxmlLoadFile(NULL, File, MXML_TEXT_CALLBACK);
	_NodeBouy = mxmlGetFirstChild(_NodeXml);
	for (; NULL != _NodeBouy; _NodeBouy = mxmlWalkNext(_NodeBouy, _NodeXml, MXML_NO_DESCEND))
	{
		if (tmxmlIsElement(_NodeBouy, "enemy"))
		{
			_NodeEnemyBouy = mxmlGetFirstChild(_NodeBouy);
			for (; NULL != _NodeEnemyBouy; _NodeEnemyBouy = mxmlWalkNext(_NodeEnemyBouy, _NodeBouy, MXML_NO_DESCEND))
			{
				if (tmxmlIsElement(_NodeEnemyBouy, "type"))
				{
					_Index = tmxmlElementReadChildInt(_NodeEnemyBouy);
				}
				else if (tmxmlIsElement(_NodeEnemyBouy, "life_point"))
				{
					g_CfgGameEnemyDataTable[_Index].life_point = tmxmlElementReadChildInt(_NodeEnemyBouy);
				}
				else if (tmxmlIsElement(_NodeEnemyBouy, "bomb_type"))
				{
					g_CfgGameEnemyDataTable[_Index].bomb_type = tmxmlElementReadChildInt(_NodeEnemyBouy);
				}
				else if (tmxmlIsElement(_NodeEnemyBouy, "bomb_offset"))
				{
					g_CfgGameEnemyDataTable[_Index].bomb_offset = tmxmlElementReadChildInt(_NodeEnemyBouy);
				}
				else if (tmxmlIsElement(_NodeEnemyBouy, "bomb_delay"))
				{
					g_CfgGameEnemyDataTable[_Index].bomb_delay = tmxmlElementReadChildFloat(_NodeEnemyBouy);
				}
				else if (tmxmlIsElement(_NodeEnemyBouy, "collision_body_table"))
				{
					tmxmlReadCGPointTable(_NodeEnemyBouy, &g_CfgGameEnemyDataTable[_Index].box2d_collision_point_table_body);
				}
				else if (tmxmlIsElement(_NodeEnemyBouy, "collision_armor_table"))
				{
					tmxmlReadCGPointTable(_NodeEnemyBouy, &g_CfgGameEnemyDataTable[_Index].box2d_collision_point_table_armor);
				}
				else if (tmxmlIsElement(_NodeEnemyBouy, "life_bar_position"))
				{
					uiLoadPointFromXML(_NodeEnemyBouy, &g_CfgGameEnemyDataTable[_Index].life_bar_position);
				}
				else if (tmxmlIsElement(_NodeEnemyBouy, "default_image_path"))
				{
					tmxmlElementReadChildText(_NodeEnemyBouy, g_CfgGameEnemyDataTable[_Index].default_image_path);
				}
				else if (tmxmlIsElement(_NodeEnemyBouy, "animation_move"))
				{
					uiLoadAnimationObjectFromXML(_NodeEnemyBouy, &g_CfgGameEnemyDataTable[_Index].ani_move);
				}
				else if (tmxmlIsElement(_NodeEnemyBouy, "animation_attack"))
				{
					uiLoadAnimationObjectFromXML(_NodeEnemyBouy, &g_CfgGameEnemyDataTable[_Index].ani_attack);
				}
				else if (tmxmlIsElement(_NodeEnemyBouy, "animation_die"))
				{
					uiLoadAnimationObjectFromXML(_NodeEnemyBouy, &g_CfgGameEnemyDataTable[_Index].ani_die);
				}
				else if (tmxmlIsElement(_NodeEnemyBouy, "animation_shock_wave"))
				{
					uiLoadAnimationObjectFromXML(_NodeEnemyBouy, &g_CfgGameEnemyDataTable[_Index].ani_shock_wave);
				}
				else if (tmxmlIsElement(_NodeEnemyBouy, "animation_cover"))
				{
					uiLoadAnimationObjectFromXML(_NodeEnemyBouy, &g_CfgGameEnemyDataTable[_Index].ani_cover);
				}
				else if (tmxmlIsElement(_NodeEnemyBouy, "animation_mouth"))
				{
					uiLoadAnimationObjectFromXML(_NodeEnemyBouy, &g_CfgGameEnemyDataTable[_Index].ani_mouth);
				}
				else if (tmxmlIsElement(_NodeEnemyBouy, "animation_mosquito"))
				{
					uiLoadAnimationObjectFromXML(_NodeEnemyBouy, &g_CfgGameEnemyDataTable[_Index].ani_mosquito);
				}
			}
		}
		else if (tmxmlIsElement(_NodeBouy, "boss_1"))
		{
			_NodeBoss1Bouy = mxmlGetFirstChild(_NodeBouy);
			for (; NULL != _NodeBoss1Bouy; _NodeBoss1Bouy = mxmlWalkNext(_NodeBoss1Bouy, _NodeBouy, MXML_NO_DESCEND))
			{
				if (tmxmlIsElement(_NodeBoss1Bouy, "life_point"))
				{
					g_CfgGameBoss1Data.life_point = tmxmlElementReadChildInt(_NodeBoss1Bouy);
				}
				else if (tmxmlIsElement(_NodeBoss1Bouy, "bomb_type"))
				{
					g_CfgGameBoss1Data.bomb_type = tmxmlElementReadChildInt(_NodeBoss1Bouy);
				}
				else if (tmxmlIsElement(_NodeBoss1Bouy, "bomb_offset"))
				{
					g_CfgGameBoss1Data.bomb_offset = tmxmlElementReadChildInt(_NodeBoss1Bouy);
				}
				else if (tmxmlIsElement(_NodeBoss1Bouy, "collision_head"))
				{
					tmxmlReadCGPointTable(_NodeBoss1Bouy, &g_CfgGameBoss1Data.box2d_collision_point_table_head);
				}
				else if (tmxmlIsElement(_NodeBoss1Bouy, "collision_body"))
				{
					tmxmlReadCGPointTable(_NodeBoss1Bouy, &g_CfgGameBoss1Data.box2d_collision_point_table_body);
				}
				else if (tmxmlIsElement(_NodeBoss1Bouy, "life_bar_position"))
				{
					uiLoadPointFromXML(_NodeBoss1Bouy, &g_CfgGameBoss1Data.life_bar_position);
				}
				else if (tmxmlIsElement(_NodeBoss1Bouy, "default_image_path"))
				{
					tmxmlElementReadChildText(_NodeBoss1Bouy, g_CfgGameBoss1Data.default_image_path);
				}
				else if (tmxmlIsElement(_NodeBoss1Bouy, "ani_move"))
				{
					uiLoadAnimationObjectFromXML(_NodeBoss1Bouy, &g_CfgGameBoss1Data.ani_move);
				}
				else if (tmxmlIsElement(_NodeBoss1Bouy, "ani_attack"))
				{
					uiLoadAnimationObjectFromXML(_NodeBoss1Bouy, &g_CfgGameBoss1Data.ani_attack);
				}
				else if (tmxmlIsElement(_NodeBoss1Bouy, "tail_life_point"))
				{
					g_CfgGameBoss1Data.tail_life_point = tmxmlElementReadChildInt(_NodeBoss1Bouy);
				}
				else if (tmxmlIsElement(_NodeBoss1Bouy, "tail_image_path"))
				{
					tmxmlElementReadChildText(_NodeBoss1Bouy, g_CfgGameBoss1Data.tail_image_path);
				}
				else if (tmxmlIsElement(_NodeBoss1Bouy, "tail_left_collision_table"))
				{
					tmxmlReadCGPointTable(_NodeBoss1Bouy, &g_CfgGameBoss1Data.box2d_collision_point_table_tail_left);
				}
				else if (tmxmlIsElement(_NodeBoss1Bouy, "tail_right_collision_table"))
				{
					tmxmlReadCGPointTable(_NodeBoss1Bouy, &g_CfgGameBoss1Data.box2d_collision_point_table_tail_right);
				}
			}
		}
		else if (tmxmlIsElement(_NodeBouy, "boss_2"))
		{
			_NodeBoss2Bouy = mxmlGetFirstChild(_NodeBouy);
			for (; NULL != _NodeBoss2Bouy; _NodeBoss2Bouy = mxmlWalkNext(_NodeBoss2Bouy, _NodeBouy, MXML_NO_DESCEND))
			{
				if (tmxmlIsElement(_NodeBoss2Bouy, "life_point"))
				{
					g_CfgGameBoss2Data.life_point = tmxmlElementReadChildInt(_NodeBoss2Bouy);
				}
				else if (tmxmlIsElement(_NodeBoss2Bouy, "bomb_type"))
				{
					g_CfgGameBoss2Data.bomb_type = tmxmlElementReadChildInt(_NodeBoss2Bouy);
				}
				else if (tmxmlIsElement(_NodeBoss2Bouy, "bomb_offset"))
				{
					g_CfgGameBoss2Data.bomb_offset = tmxmlElementReadChildInt(_NodeBoss2Bouy);
				}
				else if (tmxmlIsElement(_NodeBoss2Bouy, "collision_body"))
				{
					tmxmlReadCGPointTable(_NodeBoss2Bouy, &g_CfgGameBoss2Data.box2d_collision_point_table_body);
				}
				else if (tmxmlIsElement(_NodeBoss2Bouy, "life_bar_position"))
				{
					uiLoadPointFromXML(_NodeBoss2Bouy, &g_CfgGameBoss2Data.life_bar_position);
				}
				else if (tmxmlIsElement(_NodeBoss2Bouy, "default_image_path"))
				{
					tmxmlElementReadChildText(_NodeBoss2Bouy, g_CfgGameBoss2Data.default_image_path);
				}
				else if (tmxmlIsElement(_NodeBoss2Bouy, "ani_move"))
				{
					uiLoadAnimationObjectFromXML(_NodeBoss2Bouy, &g_CfgGameBoss2Data.ani_move);
				}
				else if (tmxmlIsElement(_NodeBoss2Bouy, "ani_attack"))
				{
					uiLoadAnimationObjectFromXML(_NodeBoss2Bouy, &g_CfgGameBoss2Data.ani_attack);
				}
				else if (tmxmlIsElement(_NodeBoss2Bouy, "ani_die"))
				{
					uiLoadAnimationObjectFromXML(_NodeBoss2Bouy, &g_CfgGameBoss2Data.ani_die);
				}
				else if (tmxmlIsElement(_NodeBoss2Bouy, "collision_skull"))
				{
					tmxmlReadCGPointTable(_NodeBoss2Bouy, &g_CfgGameBoss2Data.box2d_collision_point_table_skull);
				}
				else if (tmxmlIsElement(_NodeBoss2Bouy, "skull_image_path"))
				{
					tmxmlElementReadChildText(_NodeBoss2Bouy, g_CfgGameBoss2Data.skull_image_path);
				}
				else if (tmxmlIsElement(_NodeBoss2Bouy, "weak_point_image_path"))
				{
					tmxmlElementReadChildText(_NodeBoss2Bouy, g_CfgGameBoss2Data.weak_point_image_path);
				}
			}
		}
		else if (tmxmlIsElement(_NodeBouy, "boss_3"))
		{
			_NodeBoss3Bouy = mxmlGetFirstChild(_NodeBouy);
			for (; NULL != _NodeBoss3Bouy; _NodeBoss3Bouy = mxmlWalkNext(_NodeBoss3Bouy, _NodeBouy, MXML_NO_DESCEND))
			{
				if (tmxmlIsElement(_NodeBoss3Bouy, "life_point"))
				{
					g_CfgGameBoss3Data.life_point = tmxmlElementReadChildInt(_NodeBoss3Bouy);
				}
				else if (tmxmlIsElement(_NodeBoss3Bouy, "bomb_type"))
				{
					g_CfgGameBoss3Data.bomb_type = tmxmlElementReadChildInt(_NodeBoss3Bouy);
				}
				else if (tmxmlIsElement(_NodeBoss3Bouy, "bomb_offset"))
				{
					g_CfgGameBoss3Data.bomb_offset = tmxmlElementReadChildInt(_NodeBoss3Bouy);
				}
				else if (tmxmlIsElement(_NodeBoss3Bouy, "collision_head"))
				{
					tmxmlReadCGPointTable(_NodeBoss3Bouy, &g_CfgGameBoss3Data.box2d_collision_point_table_head);
				}
				else if (tmxmlIsElement(_NodeBoss3Bouy, "collision_body"))
				{
					tmxmlReadCGPointTable(_NodeBoss3Bouy, &g_CfgGameBoss3Data.box2d_collision_point_table_body);
				}
				else if (tmxmlIsElement(_NodeBoss3Bouy, "collision_ass"))
				{
					tmxmlReadCGPointTable(_NodeBoss3Bouy, &g_CfgGameBoss3Data.box2d_collision_point_table_ass);
				}
				else if (tmxmlIsElement(_NodeBoss3Bouy, "life_bar_position"))
				{
					uiLoadPointFromXML(_NodeBoss3Bouy, &g_CfgGameBoss3Data.life_bar_position);
				}
				else if (tmxmlIsElement(_NodeBoss3Bouy, "default_image_path"))
				{
					tmxmlElementReadChildText(_NodeBoss3Bouy, g_CfgGameBoss3Data.default_image_path);
				}
				else if (tmxmlIsElement(_NodeBoss3Bouy, "ani_appear"))
				{
					uiLoadAnimationObjectFromXML(_NodeBoss3Bouy, &g_CfgGameBoss3Data.ani_appear);
				}
				else if (tmxmlIsElement(_NodeBoss3Bouy, "ani_move"))
				{
					uiLoadAnimationObjectFromXML(_NodeBoss3Bouy, &g_CfgGameBoss3Data.ani_move);
				}
				else if (tmxmlIsElement(_NodeBoss3Bouy, "ani_attack"))
				{
					uiLoadAnimationObjectFromXML(_NodeBoss3Bouy, &g_CfgGameBoss3Data.ani_attack);
				}
				else if (tmxmlIsElement(_NodeBoss3Bouy, "ani_eye_open"))
				{
					uiLoadAnimationObjectFromXML(_NodeBoss3Bouy, &g_CfgGameBoss3Data.ani_eye_open);
				}
				else if (tmxmlIsElement(_NodeBoss3Bouy, "ani_eye_close"))
				{
					uiLoadAnimationObjectFromXML(_NodeBoss3Bouy, &g_CfgGameBoss3Data.ani_eye_close);
				}
				else if (tmxmlIsElement(_NodeBoss3Bouy, "child_eye_position_table"))
				{
					tmxmlReadCGPointTable(_NodeBoss3Bouy, &g_CfgGameBoss3Data.child_eye_position_table);
				}
				else if (tmxmlIsElement(_NodeBoss3Bouy, "child_eye_size"))
				{
					uiLoadSizeFromXML(_NodeBoss3Bouy, &g_CfgGameBoss3Data.child_eye_size);
				}
				else if (tmxmlIsElement(_NodeBoss3Bouy, "ani_child_eye_open"))
				{
					uiLoadAnimationObjectFromXML(_NodeBoss3Bouy, &g_CfgGameBoss3Data.ani_child_eye_open);
				}
				else if (tmxmlIsElement(_NodeBoss3Bouy, "ani_child_eye_close"))
				{
					uiLoadAnimationObjectFromXML(_NodeBoss3Bouy, &g_CfgGameBoss3Data.ani_child_eye_close);
				}
			}
		}
	}
	mxmlDelete(_NodeXml);
}

void CfgGameLoadTableBomb(FILE *File)
{
	mxml_node_t *_NodeXml, *_NodeBouy, *_NodeBombBouy, *_NodeSwirlBouy;
	int _Index;

	_NodeXml = mxmlLoadFile(NULL, File, MXML_TEXT_CALLBACK);
	_NodeBouy = mxmlGetFirstChild(_NodeXml);
	for (; NULL != _NodeBouy; _NodeBouy = mxmlWalkNext(_NodeBouy, _NodeXml, MXML_NO_DESCEND))
	{
		if (tmxmlIsElement(_NodeBouy, "bomb"))
		{
			_NodeBombBouy = mxmlGetFirstChild(_NodeBouy);
			for (; NULL != _NodeBombBouy; _NodeBombBouy = mxmlWalkNext(_NodeBombBouy, _NodeBouy, MXML_NO_DESCEND))
			{
				if (tmxmlIsElement(_NodeBombBouy, "type"))
				{
					_Index = tmxmlElementReadChildInt(_NodeBombBouy);
				}
				else if (tmxmlIsElement(_NodeBombBouy, "attack_point"))
				{
					g_CfgGameBombDataTable[_Index].attack_point = tmxmlElementReadChildInt(_NodeBombBouy);
				}
				else if (tmxmlIsElement(_NodeBombBouy, "can_be_destroy"))
				{
					g_CfgGameBombDataTable[_Index].can_be_destroy = tmxmlElementReadChildInt(_NodeBombBouy);
				}
				else if (tmxmlIsElement(_NodeBombBouy, "collision"))
				{
					tmxmlReadCGPointTable(_NodeBombBouy, &g_CfgGameBombDataTable[_Index].box2d_collision_point_table);
				}
				else if (tmxmlIsElement(_NodeBombBouy, "image_path"))
				{
					tmxmlElementReadChildText(_NodeBombBouy, g_CfgGameBombDataTable[_Index].image_path);
				}
				else if (tmxmlIsElement(_NodeBombBouy, "animation_fly"))
				{
					uiLoadAnimationObjectFromXML(_NodeBombBouy, &g_CfgGameBombDataTable[_Index].ani_fly);
				}
				else if (tmxmlIsElement(_NodeBombBouy, "effect_explosion_path"))
				{
					tmxmlElementReadChildText(_NodeBombBouy, g_CfgGameBombDataTable[_Index].particle_effect_explode);
				}
			}
		}
		else if (tmxmlIsElement(_NodeBouy, "swirl"))
		{
			_NodeSwirlBouy = mxmlGetFirstChild(_NodeBouy);
			for (; NULL != _NodeSwirlBouy; _NodeSwirlBouy = mxmlWalkNext(_NodeSwirlBouy, _NodeBouy, MXML_NO_DESCEND))
			{
				if (tmxmlIsElement(_NodeSwirlBouy, "type"))
				{
					_Index = tmxmlElementReadChildInt(_NodeSwirlBouy);
				}
				else if (tmxmlIsElement(_NodeSwirlBouy, "life_cycle"))
				{
					g_CfgGameSwirlDataTable[_Index].life_cycle = tmxmlElementReadChildFloat(_NodeSwirlBouy);
				}
				else if (tmxmlIsElement(_NodeSwirlBouy, "eat_heart_time"))
				{
					g_CfgGameSwirlDataTable[_Index].eat_heart_time = tmxmlElementReadChildFloat(_NodeSwirlBouy);
				}
				else if (tmxmlIsElement(_NodeSwirlBouy, "image_path"))
				{
					tmxmlElementReadChildText(_NodeSwirlBouy, g_CfgGameSwirlDataTable[_Index].image_path);
				}
				else if (tmxmlIsElement(_NodeSwirlBouy, "ani"))
				{
					uiLoadAnimationObjectFromXML(_NodeSwirlBouy, &g_CfgGameSwirlDataTable[_Index].ani);
				}
			}
		}
	}
	mxmlDelete(_NodeXml);
}

void CfgGameLoadTableHeart(FILE *File)
{
	mxml_node_t *_NodeXml, *_NodeBouy;

	_NodeXml = mxmlLoadFile(NULL, File, MXML_TEXT_CALLBACK);
	_NodeBouy = mxmlGetFirstChild(_NodeXml);
	for (; NULL != _NodeBouy; _NodeBouy = mxmlWalkNext(_NodeBouy, _NodeXml, MXML_NO_DESCEND))
	{
		if (tmxmlIsElement(_NodeBouy, "life_cycle"))
		{
			g_CfgGameHeartData.life_cycle = tmxmlElementReadChildFloat(_NodeBouy);
		}
		else if (tmxmlIsElement(_NodeBouy, "collision"))
		{
			tmxmlReadCGPointTable(_NodeBouy, &g_CfgGameHeartData.box2d_collision_point_table);
		}
		else if (tmxmlIsElement(_NodeBouy, "default_image_path"))
		{
			tmxmlElementReadChildText(_NodeBouy, g_CfgGameHeartData.default_image_path);
		}
		else if (tmxmlIsElement(_NodeBouy, "animation_fly"))
		{
			uiLoadAnimationObjectFromXML(_NodeBouy, &g_CfgGameHeartData.ani_fly);
		}
		else if (tmxmlIsElement(_NodeBouy, "animation_die"))
		{
			uiLoadAnimationObjectFromXML(_NodeBouy, &g_CfgGameHeartData.ani_die);
		}
		else if (tmxmlIsElement(_NodeBouy, "dark_image_path"))
		{
			tmxmlElementReadChildText(_NodeBouy, g_CfgGameHeartData.dark_image_path);
		}
		else if (tmxmlIsElement(_NodeBouy, "animation_dark_fly"))
		{
			uiLoadAnimationObjectFromXML(_NodeBouy, &g_CfgGameHeartData.ani_dark_fly);
		}
		else if (tmxmlIsElement(_NodeBouy, "animation_dark_die"))
		{
			uiLoadAnimationObjectFromXML(_NodeBouy, &g_CfgGameHeartData.ani_dark_die);
		}
	}
	mxmlDelete(_NodeXml);
}